<?php
class AutoTimestampBehavior extends CActiveRecordBehavior {
 
  /**
   * The field that stores the modification time
   */
  public $modified = 'modified';
 
  public function beforeValidate() {
    $this->Owner->{$this->modified} = date('Y-m-d H:i:s', time());
    return true;    
  }
}
